<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jq/jquery.js"></script>
<title>Insert title here</title>
</head>
<body>
<center>
	<label>用户名:</label><input type="text" id="username" value="zhangsan" /><p/>
	<label>密码:</label><input type="password" id="password" value="123" /><p/>
	<input id="login" type="button" value="登录"/><p/><a href="addUser.jsp">注册</a>
	<span id="msg"></span>
</center>
</body>
<script type="text/javascript">
	
	$(function () {
		$("#login").click(function () {
			$.ajax({
				url:"TestContrl/userLogin.do",
				data:{"username":$("#username").val(),"password":$("#password").val()},
				type:"post",
				dataType:"json",
				success:function(date){
					if(date.result){
						location.href="TestContrl/querySheng.do";
					}else{
						$("#msg").css("color","red").html("登录信息异常");
					}
				},
				error:function(){
					alert("出现异常");
				}
			});
		});
	});
</script>
</html>